package com.proj.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("shopping")
public class ShoppingController {

    @RequestMapping("index")
    public String index(){
        return "shopping/index.html";
    }
    @RequestMapping("login")
    public String login(){
        return "shopping/login.html";
    }
    @RequestMapping("cart")
    public String cart(){
        return "shopping/cart.html";
    }

    @RequestMapping("goods")
    public String goods(Integer categoryid,String keywords,Model model){
        model.addAttribute("categoryid",categoryid);
        model.addAttribute("keywords",keywords);
        return "shopping/products.html";
    }

    @RequestMapping("single")
    public String single(Integer id, Model model){
        //这个参数名“id”必须和前台传过来的参数名一致
        model.addAttribute("id", id);
        return "shopping/single.html";
    }
    @RequestMapping("register")
    public String register(){
        return "shopping/register.html";
    }
    @RequestMapping("userinfo")
    public String userinfo(){
        return "shopping/userinfo.html";
    }
    @RequestMapping("settlement")
    public String settlement(){
        return "shopping/settlement.html";
    }
    @RequestMapping("payment")
    public String payment(){
        return "shopping/payment.html";
    }
}
